package com.example.tests;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import java.util.Iterator;
import java.util.Set;

import org.testng.annotations.Test;

public class GroupRemovalTests extends TestBase {
	@Test
	public void testFirstGroupCanBeRemoved() throws Exception {
		GroupObject deletedGroup = new GroupObject().setName("")
				.setHeader("").setFooter("");
		Set<GroupObject> oldList = app.getGroupHelper().getGroups();
		app.getGroupHelper().deleteGroup(0);
		Set<GroupObject> newList = app.getGroupHelper().getGroups();
		verifyGroupRemoved(oldList, deletedGroup, newList);
	}

		
	private void verifyGroupRemoved(Set<GroupObject> oldList, GroupObject deletedGroup, Set<GroupObject> newList) {
		assertThat(newList.size(), equalTo(oldList.size() - 1));
		oldList.remove(deletedGroup);
		assertThat(newList, equalTo(oldList));
		
	}

	

	@Test
	public void testAllGroupsCanBeRemoved() throws Exception {
		// app.getGroupHelper().deleteGroups();
		// validate
	}

}
